<?php
/**
 * 应用自定义视图模板类
 * 
 * @version $Id: AdminView.php 258 2012-04-10 14:40:03Z linsir123 $
 */
class AdminView
{
	/**
	 * 初始化
	 */
	static function init()
	{
		static $__init = false;
		if ($__init) {
			return ;
		}
		$__init = true;
		
		///
		$view = App::getView();
		$engine = & $view->engine;
		
		/// 函数
		$engine->registerPlugin('function', 'nav', 	array('AdminView', 'smartyNav'));
	}
	
	/**
	 * Javascript
	 */
	static function smartyNav($params = null)
	{
		$navs = array(
			array('用户中心', array(
				array('用户列表', 'admin/user'),
				array('订单列表', 'admin/order'),
				array('支付列表', 'admin/exchange')
			)),
			array('数据导入', array(
				array('淘宝报表', 'admin/report')
			)),
		);
		
		///
		$content = "";
		foreach ($navs as $v) {
			list($title, $subs) = $v;
			$content .= '<li class="list_title"><span>'.$title.'</span><ul class="submenu">';
			foreach ($subs as $s) {
				list($title, $r) = $s;
				$url = lpUrl::__($r);
				$content .= '<li><a class="AIframe" url="'.$url.'" title="'.$title.'">'.$title.'</a></li>';
			}
			$content .= '</ul></li>';
		}
		
		return $content;
	}
}
